/*
 * Filename:    IndicatorConfigDaoImpl.java
 * Copyright:   2014 中国平安保险（集团）股份有限公司 版权所有
 * Company:     平安科技养老险及健康险系统开发部
 * Create at:   2014年10月10日
 */
package com.paic.mhis.hcpms.quota.indicatorconfig.intergration.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Component;

import com.paic.mhis.core.user.dto.RegionDTO;
import com.paic.mhis.hcpms.quota.indicatorconfig.dto.IndicatorAreaDTO;
import com.paic.mhis.hcpms.quota.indicatorconfig.dto.IndicatorBaseDTO;
import com.paic.mhis.hcpms.quota.indicatorconfig.dto.IndicatorConfigDTO;
import com.paic.mhis.hcpms.quota.indicatorconfig.dto.IndicatorOrgDTO;
import com.paic.mhis.hcpms.quota.indicatorconfig.dto.IndicatorTypeDTO;
import com.paic.mhis.hcpms.quota.indicatorconfig.dto.IndicatorValueDTO;
import com.paic.mhis.hcpms.quota.indicatorconfig.dto.IndicatorValues4CalDTO;
import com.paic.mhis.hcpms.quota.indicatorconfig.dto.IndicatorWarnValueDTO;
import com.paic.mhis.hcpms.quota.indicatorconfig.intergration.dao.IndicatorConfigDAO;
import com.paic.pafa.biz.dao.BaseDAO;

/**
 * 
 * @author EX-XIEQI001
 * 
 */
@Component("indicatorConfigDao")
public class IndicatorConfigDaoImpl extends BaseDAO implements IndicatorConfigDAO {

	@Override
	public List<IndicatorBaseDTO> queryIndicatorBaseAll(String regionCode) {
		return (List<IndicatorBaseDTO>) this._list("indicator.queryALL", regionCode);
	}

	@Override
	public List<IndicatorBaseDTO> queryIndicatorAddAll(Map<String, Object> map) {
		return (List<IndicatorBaseDTO>) this._list("indicator.canAddALL", map);
	}

	@Override
	public int queryIndicatorAddTotal(Map<String, Object> map) {
		return this._getInt("indicator.canAddTotal", map);
	}

	@Override
	public boolean isLockIndicator(String regionCode) {
		int flag = this._getInt("indicator.isLockedIndicator", regionCode);

		if (flag > 0) {
			return true;
		}
		return false;
	}

	@Override
	public IndicatorAreaDTO queryIndicatorArea(Map<String, Object> map) {
		return (IndicatorAreaDTO) this._getObject("indicator.queryIndicatorArea", map);
	}

	@Override
	public IndicatorBaseDTO queryIndicatorBase(Map<String, Object> map) {
		return (IndicatorBaseDTO) this._getObject("indicator.queryIndicatorBase", map);
	}

	@Override
	public List<IndicatorTypeDTO> queryIndicatorTypeBaseAll(String kpiId) {
		return (List<IndicatorTypeDTO>) this._list("indicator.queryIndicatorTypeBaseAll", kpiId);
	}

	@Override
	public List<IndicatorOrgDTO> queryIndicatorOrgBaseAll(String kpiId) {
		return (List<IndicatorOrgDTO>) this._list("indicator.queryIndicatorOrgBaseAll", kpiId);
	}

	@Override
	public List<IndicatorValueDTO> queryIndicatorValueBaseAll(String kpiId) {
		return (List<IndicatorValueDTO>) this._list("indicator.queryIndicatorValueBaseAll", kpiId);
	}

	@Override
	public String insertIndicatorConfig(IndicatorConfigDTO dto) {
		Object object = this._insert("indicator.insertIndicatorConfig", dto);
		return object.toString();
	}

	@Override
	public void insertIndicatorTypes(List<IndicatorTypeDTO> dtos) {
		this._insert("indicator.insertIndicatorType", dtos);

	}

	@Override
	public void insertIndicatorOrgs(List<IndicatorOrgDTO> dtos) {
		this._insert("indicator.insertIndicatorOrg", dtos);

	}

	@Override
	public void insertIndicatorValues(List<IndicatorValueDTO> dtos) {
		this._insert("indicator.insertIndicatorValue", dtos);

	}

	@Override
	public void updateIndicatorArea(IndicatorAreaDTO dto) {
		this._update("indicator.updateIndicatorArea", dto);

	}

	@Override
	public IndicatorConfigDTO queryIndicatorConfig(Map<String, Object> map) {
		return (IndicatorConfigDTO) this._getObject("indicator.queryIndicatorConfig", map);
	}

	@Override
	public List<IndicatorTypeDTO> queryIndicatorTypeAll(String kpiConfigId) {
		return (List<IndicatorTypeDTO>) this._list("indicator.queryIndicatorTypeAll", kpiConfigId);
	}

	@Override
	public List<IndicatorOrgDTO> queryIndicatorOrgAll(String kpiConfigId) {
		return (List<IndicatorOrgDTO>) this._list("indicator.queryIndicatorOrgAll", kpiConfigId);
	}

	@Override
	public List<IndicatorValueDTO> queryIndicatorValueAll(String kpiConfigId) {
		return (List<IndicatorValueDTO>) this._list("indicator.queryIndicatorValueAll", kpiConfigId);
	}

	@Override
	public void deleteIndicatorType(String kpiConfigId) {
		this._delete("indicator.deleteIndicatorType", kpiConfigId);

	}

	@Override
	public void deleteIndicatorOrg(String kpiConfigId) {
		this._delete("indicator.deleteIndicatorOrg", kpiConfigId);

	}

	@Override
	public void deleteIndicatorValue(String kpiConfigId) {
		this._delete("indicator.deleteIndicatorValue", kpiConfigId);
	}

	@Override
	public void updateIndicatorValue(Map<String, Object> map) {
		this._update("indicator.updateIndicatorValue", map);

	}

	@Override
	public List<IndicatorAreaDTO> queryIndicatorAreaAll(String regionCode) {

		return (List<IndicatorAreaDTO>) this._list("indicator.queryIndicatorAreaAll", regionCode);
	}

	@Override
	public List<IndicatorWarnValueDTO> queryIndicatorWarnValueBaseAll(String kpiId) {
		return (List<IndicatorWarnValueDTO>) this._list("indicator.queryIndicatorWarnValueBaseAll", kpiId);
	}

	@Override
	public void insertIndicatorWarnValue(List<IndicatorWarnValueDTO> dtos) {
		this._insert("indicator.insertIndicatorWarnValue", dtos);
	}

	@Override
	public List<IndicatorWarnValueDTO> queryIndicatorWarnValueAll(String kpiConfigId) {
		return (List<IndicatorWarnValueDTO>) this._list("indicator.queryIndicatorWarnValueAll", kpiConfigId);
	}

	@Override
	public void updateIndicatorWarnValue(Map<String, Object> map) {
		this._update("indicator.updateIndicatorWarnValue", map);
	}

	@Override
	public void updateIndicatorConfig(IndicatorConfigDTO dto) {
		this._update("indicator.updateIndicatorConfig", dto);

	}

	public List<IndicatorValues4CalDTO> queryKpiValues4Cal(Map<String, Object> map) {
		return (List<IndicatorValues4CalDTO>) this._list("indicator.queryKpiValuesCal", map);
	}

	@Override
	public List<RegionDTO> queryRegionByUserName(String userName) {
		return (List<RegionDTO>) _list("indicator.queryRegionByUserName", userName);
	}

	@Override
	public int numOfOrg(Map<String,Object> map) {
		return this._getInt("indicator.numOfOrg", map);
	}

}
